GBML manual / Rooms

What a world remembers

Things that stay done, roamers, changed tiles and travel between worlds, and what is saved.

A world is one huge map you paint like a room. The game builds it in pieces and swaps them as the player walks, so only a part of it is ever loaded. Everything in the loaded part is as you placed it, and starts afresh each time that part is loaded, except the four things below, which the world keeps.

Remembered things

Right-click a thing you placed in a world (a chest, a pickup, an enemy, a gate) and turn on Remembered in the world, and the world keeps one mark for it.

The marks are saved with the game (save_commit) and given up by save_clear. They take one bit each: 4,000 Remembered things are 500 bytes of the save.

Roamers

roam_boundary makes a thing a roamer of the world. It stays inside its rectangle, waits where it was when its part of the world is left, and comes back there when a part that holds it is loaded. Room for 32 roamers, or the number you set in Project Settings, under Capacities, Roamers a world can keep (from 1 to 255); they are not saved with the game.

Changed tiles

tile_set_class, tile_set_flags and tile_set_index work anywhere in a world, including in a part that is not loaded (a switch that opens a gate far away). The world keeps the change, writes it back each time that part is loaded, and saves it with the game. It keeps up to 256 changed squares in all, or the number you set in Project Settings, under Capacities, Tile changes a world can keep (from 1 to 1500); a change past that is ignored and counted in the debug overlay. A tile and its collision count as separate changes of one square.

Several worlds

A game can have several worlds, and each keeps its own marks and changed tiles. world_go takes the player to another one with the usual room change, and world_current says which world the player is in.

The camera

camera_bounds set by your code is a place in the world and carries on as the player walks from one part to the next. Where it would put the camera outside what the loaded part can show, the camera follows the player instead.

What is saved

The marks and the changed tiles, in a little over 16 bytes plus what they take (one bit for each Remembered thing, 8 bytes for each changed square). Project Settings shows the number under Save size ("Worlds remember N things: X bytes of the save").

See also: world_rememberworld_rememberedroam_boundaryroam_stopworld_goworld_currentWhere (0, 0) is